#include <asm-xen/evtchn.h>
#include <asm-xen/hypervisor.h>
#include <asm-xen/xen-public/dom0_ops.h>
-#include <asm-xen/linux-public/suspend.h>
#include <asm-xen/queues.h>
#include <asm-xen/xenbus.h>
#include <asm-xen/ctrl_if.h>
static int __do_suspend(void *ignore)
{
int i, j;
- suspend_record_t *suspend_record;
#ifdef CONFIG_XEN_USB_FRONTEND
extern void usbif_resume();
}
#endif
- suspend_record = (suspend_record_t *)__get_free_page(GFP_KERNEL);
- if ( suspend_record == NULL )
- goto out;
-
preempt_disable();
#ifdef CONFIG_SMP
/* Take all of the other cpus offline. We need to be careful not
}
#endif
- suspend_record->nr_pfns = max_pfn; /* final number of pfns */
-
__cli();
preempt_enable();
HYPERVISOR_shared_info = (shared_info_t *)empty_zero_page;
clear_fixmap(FIX_SHARED_INFO);
- memcpy(&suspend_record->resume_info, xen_start_info,
- sizeof(*xen_start_info));
-
/* We'll stop somewhere inside this hypercall. When it returns,
we'll start resuming after the restore. */
- HYPERVISOR_suspend(virt_to_mfn(suspend_record));
+ HYPERVISOR_suspend(virt_to_mfn(xen_start_info));
shutting_down = SHUTDOWN_INVALID;
- memcpy(xen_start_info, &suspend_record->resume_info,
- sizeof(*xen_start_info));
-
set_fixmap(FIX_SHARED_INFO, xen_start_info->shared_info);
HYPERVISOR_shared_info = (shared_info_t *)fix_to_virt(FIX_SHARED_INFO);
}
#endif
- out:
- if ( suspend_record != NULL )
- free_page((unsigned long)suspend_record);
return err;
}
+++ /dev/null
-/******************************************************************************
- * suspend.h
- *
- * Copyright (c) 2003-2004, K A Fraser
- *
- * This file may be distributed separately from the Linux kernel, or
- * incorporated into other software packages, subject to the following license:
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this source file (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use, copy, modify,
- * merge, publish, distribute, sublicense, and/or sell copies of the Software,
- * and to permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- * IN THE SOFTWARE.
- */
-
-#ifndef __ASM_XEN_SUSPEND_H__
-#define __ASM_XEN_SUSPEND_H__
-
-typedef struct suspend_record_st {
- /* To be filled in before resume. */
- start_info_t resume_info;
- /*
- * The number of a machine frame containing, in sequence, the number of
- * each machine frame that contains PFN -> MFN translation table data.
- */
- unsigned long pfn_to_mfn_frame_list;
- /* Number of entries in the PFN -> MFN translation table. */
- unsigned long nr_pfns;
-} suspend_record_t;
-
-#endif /* __ASM_XEN_SUSPEND_H__ */
#include <unistd.h>
#include "xg_private.h"
#include <xenctrl.h>
-#include <xen/linux/suspend.h>
#include <xen/memory.h>
#define MAX_BATCH_SIZE 1024
/* used by mapper for updating the domain's copy of the table */
unsigned long *live_pfn_to_mfn_table = NULL;
- /* A temporary mapping of the guest's suspend record. */
- suspend_record_t *p_srec;
+ /* A temporary mapping of the guest's start_info page. */
+ start_info_t *start_info;
char *region_base;
goto out;
}
ctxt.user_regs.esi = mfn = pfn_to_mfn_table[pfn];
- p_srec = xc_map_foreign_range(
+ start_info = xc_map_foreign_range(
xc_handle, dom, PAGE_SIZE, PROT_READ | PROT_WRITE, mfn);
- p_srec->resume_info.nr_pages = nr_pfns;
- p_srec->resume_info.shared_info = shared_info_frame << PAGE_SHIFT;
- p_srec->resume_info.flags = 0;
- *store_mfn = p_srec->resume_info.store_mfn =
- pfn_to_mfn_table[p_srec->resume_info.store_mfn];
- p_srec->resume_info.store_evtchn = store_evtchn;
- *console_mfn = p_srec->resume_info.console_mfn =
- pfn_to_mfn_table[p_srec->resume_info.console_mfn];
- p_srec->resume_info.console_evtchn = console_evtchn;
- munmap(p_srec, PAGE_SIZE);
+ start_info->nr_pages = nr_pfns;
+ start_info->shared_info = shared_info_frame << PAGE_SHIFT;
+ start_info->flags = 0;
+ *store_mfn = start_info->store_mfn =
+ pfn_to_mfn_table[start_info->store_mfn];
+ start_info->store_evtchn = store_evtchn;
+ *console_mfn = start_info->console_mfn =
+ pfn_to_mfn_table[start_info->console_mfn];
+ start_info->console_evtchn = console_evtchn;
+ munmap(start_info, PAGE_SIZE);
/* Uncanonicalise each GDT frame number. */
if ( ctxt.gdt_ents > 8192 )
#include "xg_private.h"
-#include <xen/linux/suspend.h>
#include <xen/io/domain_controller.h>
#define BATCH_SIZE 1024 /* 1024 pages (4MB) at a time */
/* base of the region in which domain memory is mapped */
unsigned char *region_base = NULL;
- /* A temporary mapping, and a copy, of the guest's suspend record. */
- suspend_record_t *p_srec = NULL;
+ /* A temporary mapping of the guest's start_info page. */
+ start_info_t *start_info = NULL;
/* number of pages we're dealing with */
unsigned long nr_pfns;
/* Map the suspend-record MFN to pin it. The page must be owned by
dom for this to succeed. */
- p_srec = xc_map_foreign_range(xc_handle, dom,
- sizeof(*p_srec), PROT_READ | PROT_WRITE,
- ctxt.user_regs.esi);
- if (!p_srec){
- ERR("Couldn't map suspend record");
+ start_info = xc_map_foreign_range(xc_handle, dom, PAGE_SIZE,
+ PROT_READ | PROT_WRITE,
+ ctxt.user_regs.esi);
+ if (!start_info){
+ ERR("Couldn't map start_info page");
goto out;
}
/* Canonicalize store mfn. */
- if ( !translate_mfn_to_pfn(&p_srec->resume_info.store_mfn) ) {
+ if ( !translate_mfn_to_pfn(&start_info->store_mfn) ) {
ERR("Store frame is not in range of pseudophys map");
goto out;
}
/* Canonicalize console mfn. */
- if ( !translate_mfn_to_pfn(&p_srec->resume_info.console_mfn) ) {
+ if ( !translate_mfn_to_pfn(&start_info->console_mfn) ) {
ERR("Console frame is not in range of pseudophys map");
goto out;
}
}
}
- if (nr_pfns != p_srec->nr_pfns )
- {
- ERR("Suspend record nr_pfns unexpected (%ld != %ld)",
- p_srec->nr_pfns, nr_pfns);
- goto out;
- }
-
/* Canonicalise the suspend-record frame number. */
if ( !translate_mfn_to_pfn(&ctxt.user_regs.esi) ){
ERR("Suspend record is not in range of pseudophys map");
if(live_shinfo)
munmap(live_shinfo, PAGE_SIZE);
- if(p_srec)
- munmap(p_srec, sizeof(*p_srec));
+ if(start_info)
+ munmap(start_info, PAGE_SIZE);
if(live_pfn_to_mfn_frame_list)
munmap(live_pfn_to_mfn_frame_list, PAGE_SIZE);